Page({

  /**
   * 页面的初始数据
   */
  data: {
    needFix:false,
    bannerHeight:0,
    searchlist: ["列表一", "列表二", "列表三", "列表四", "列表五", "列表六"],
    searchCont:"",
    openmore:false,
    tabdex: "",
    popshow: false,
    tablist: [
      {
        types: "综合排序",
        list: [
          { items: "父亲", checked: false },
          { items: "父亲", checked: false },
          { items: "我", checked: false },
        ]
      }, {
        types: "线下社区",
        list: [
          { items: "检验报告", checked: false },
          { items: "基因报告", checked: false },
          { items: "体检报告", checked: false },
        ]
      }, {
        types: "筛选",
        list: [
          { items: "未解读", checked: false },
          { items: "已解读", checked: false },
        ]
      },
    ],
    shequlist: ["全部社区", "锦东社区", "万科城", "东润国际", "锦绣苑", "龙源小区", "万科紫檀", "锦东社区", "万科城", "东润国际", "锦绣苑", "龙源小区", "万科紫檀", "锦东社区", "万科城", "东润国际", "锦绣苑", "龙源小区", "万科紫檀"],
    shequdex:0
  },
  shequclick(e){
    this.setData({
      shequdex:e.currentTarget.dataset.dex
    })
  },
  getSearch: function (e) {
    this.setData({
      searchCont: e.detail.value
    })
  },
  hidepop(){
    this.setData({
      popshow: false,
      tabdex: ""
    })
  },
  tabbtn(e) {
    if (e.currentTarget.dataset.dex === this.data.tabdex) {
      this.setData({
        popshow: false,
        tabdex:"",
      })
    } else {
      wx.pageScrollTo({
        scrollTop: 100,
      })
      this.setData({
        popshow: true,
        tabdex: e.currentTarget.dataset.dex,
      })
    }
  },
  itemchecked(e) {
    let arrs = this.data.tablist, i = this.data.tabdex, dex = e.currentTarget.dataset.dex
    arrs[i].list.map(item => {
      item.checked = false
    })
    arrs[i].types = arrs[i].list[dex].items
    arrs[i].list[dex].checked = true
    this.setData({
      tablist: arrs,
      popshow: false,
      tabdex: ""
    })
  },
  openmore(){
    this.setData({
      openmore: !this.data.openmore
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
  },
  onPageScroll(e){
    let h = e.scrollTop; let needFix = this.data.needFix; let bannerHeight = this.data.bannerHeight;
    if (h > 10 + bannerHeight){
      this.setData({
        needFix: true
      })
    } else if (h < 20){
      this.setData({
        needFix: false
      })
    }
    this.setData({
      bannerHeight:h
    })
  },
  doctoritem(){
    wx.navigateTo({
      url: '/hyb_yl/doctor/pages/familydoctor/servercenter/servercenter'
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  }
})